def method(n, p, nums: list):
    fs = [False] * 3
    for i in range(len(nums)):
        nums[i] %= p 
        fs[nums[i]] = True 
    if fs[0]: return 1
    elif fs[1] and fs[2]: return 2
    else: return 3
    

if __name__ == '__main__':
    n, p = [int(x) for x in input().split()]
    nums = [int(x) for x in input().split()]
    ans = method(n, p, nums)
    print(ans)